﻿using Best.SmartCms.Domain;
using Best.SmartCms.Dto.Response;
using Best.SmartCms.Dto;
using Best.SmartCms.Service;
using Microsoft.AspNetCore.Mvc;

namespace Best.SmartCms.API.Controllers
{
    /// <summary>
    /// AlipaySetting
    /// </summary>
    public class AlipaySettingController : Controller
    {
        private readonly AlipaySettingService _alipaySettingService;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="alipaySettingService"></param>
        public AlipaySettingController(AlipaySettingService alipaySettingService)
        {
            _alipaySettingService = alipaySettingService;
        }


        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("alipaysetting/create")]
        public ApiResponse Create([FromBody]AlipaySettingEditDto dto)
        {
             _alipaySettingService.Create(dto);
            return ApiResponse.Succeeds();
        }

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost]
        [Route("alipaysetting/edit")]
        public ApiResponse Edit([FromBody]AlipaySettingEditDto dto)
        {
            _alipaySettingService.Edit(dto);
            return ApiResponse.Succeeds();
        }


        /// <summary>
        /// 详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("alipaysetting/Info")]
        public ApiResponse<AlipaySettingEditDto> Info(long id)
        {
            var ret = _alipaySettingService.Info(id);
            return ApiResponse<AlipaySettingEditDto>.Succeeds(ret);
        }
    }
}